package com.user.controller;

import com.common.domain.entity.Comment;
import com.common.domain.entity.ResponseResult;
import com.common.domain.vo.CommentVo;
import com.common.service.CommentService;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author
 * @Date 2023/10/15 15:17
 **/
@RestController
public class CommentController {
    @Autowired
    private CommentService commentService;

    @GetMapping("getCommentDetail")
    public ResponseResult getCommentDetail(Long id, int pageNum, int pageSize){
        return ResponseResult.okResult(commentService.getCommentDetail(id,pageNum,pageSize));
    }

    @PostMapping("submitComment")
    public ResponseResult submitComment(@RequestBody Comment comment){
        return commentService.submitComment(comment);
    }

    @GetMapping("getCommentById")
    public ResponseResult getCommentById(Long id){

        return commentService.getCommentById( id);
    }
}
